<?php
	session_start();
	function PerformLogin($email, $password) {
		if(!empty($password)) {
			$_SESSION['User'] = array('name'=>$email);
			return true;
		}else{
			return array('password'=>'Wrong Password');
		}
	}
	function IsLoggedIn() {
		return (GetCurrentUser() != NULL);
	}
	function GetCurrentUser() {
		return isset($_SESSION['User']) ? $_SESSION['User']: NULL;
	}
	function RequireLogin() {
		if(!IsLoggedIn()) {
			redirect_to("Location: ../Accounts/login.php?returnUrl=$_SERVER[PHP_SELF]");
		}
	}
// ============================================ //
